<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>取得嵌入在 TIFF 或 JPEG 图像中的缩略图</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.exif-thumbnail" class="refentry">
  <div class="refnamediv">
   <h1 class="refname">exif_thumbnail</h1>
   <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">exif_thumbnail</span> &mdash; <span class="dc-title">取得嵌入在 TIFF 或 JPEG 图像中的缩略图</span></p>

  </div>
 <div class="refsect1 description" id="refsect1-function.exif-thumbnail-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>exif_thumbnail</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$width</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$height</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$imagetype</code></span>
  ]]] ) : <span class="type">string</span></div>

   <p class="para rdfs-comment">
    <span class="function"><strong>exif_thumbnail()</strong></span> 读取 <acronym title="Tagged Image File Format">TIFF</acronym> 或 <acronym title="Joint Photographic Experts Group">JPEG</acronym>
    图像中的嵌入缩略图。如果图像不包含缩略图则返回 <strong><code>FALSE</code></strong>。
</p>
  <p class="para">
   If you want to deliver thumbnails through this function, you should send
   the mimetype information using the <span class="function"><a href="header.html" class="function">header()</a></span> function.
   </p>
  <p class="para">
   It is possible that <span class="function"><strong>exif_thumbnail()</strong></span> cannot create an 
   image but can determine its size. In this case, the return value is 
   <strong><code>FALSE</code></strong> but <code class="parameter">width</code> and <code class="parameter">height</code> 
   are set.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.exif-thumbnail-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">filename</code></dt>

     <dd>

      <p class="para">
       The name of the image file being read.  This image contains an
       embedded thumbnail.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">width</code></dt>

     <dd>

      <p class="para">
       The return width of the returned thumbnail.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">height</code></dt>

     <dd>

      <p class="para">
       The returned height of the returned thumbnail.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">imagetype</code></dt>

     <dd>

      <p class="para">
       The returned image type of the returned thumbnail.  This is either
       <acronym title="Tagged Image File Format">TIFF</acronym> or <acronym title="Joint Photographic Experts Group">JPEG</acronym>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.exif-thumbnail-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the embedded thumbnail, or <strong><code>FALSE</code></strong> if the image contains no 
   thumbnail.
  </p>
 </div>

 <div class="refsect1 changelog" id="refsect1-function.exif-thumbnail-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.3.0</td>
       <td>
        The optional parameters <code class="parameter">width</code>, 
        <code class="parameter">height</code>, and <code class="parameter">imagetype</code> 
        all became available.
       </td>
      </tr>

      <tr>
       <td>4.3.0</td>
       <td>
        May return thumbnails in the <acronym title="Tagged Image File Format">TIFF</acronym> format.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.exif-thumbnail-examples">
  <h3 class="title">范例</h3>
  <p class="para">
    <div class="example" id="example-3636">
     <p><strong>Example #1 <span class="function"><strong>exif_thumbnail()</strong></span> 例子</strong></p>
     <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">array_key_exists</span><span style="color: #007700">(</span><span style="color: #DD0000">'file'</span><span style="color: #007700">,</span><span style="color: #0000BB">$_REQUEST</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exif_thumbnail</span><span style="color: #007700">(</span><span style="color: #0000BB">$_REQUEST</span><span style="color: #007700">[</span><span style="color: #DD0000">'file'</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">$width</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$height</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$type</span><span style="color: #007700">);<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br />if&nbsp;(</span><span style="color: #0000BB">$image</span><span style="color: #007700">!==</span><span style="color: #0000BB">false</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-type:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">image_type_to_mime_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$type</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$image</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;no&nbsp;thumbnail&nbsp;available,&nbsp;handle&nbsp;the&nbsp;error&nbsp;here<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"No&nbsp;thumbnail&nbsp;available"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
     </div>

    </div>
   </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.exif-thumbnail-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="exif_read_data.html" class="function" rel="rdfs-seeAlso">exif_read_data()</a> - 从 JPEG 或 TIFF
   文件中读取 EXIF 头信息</span></li>
    <li class="member"><span class="function"><a href="image_type_to_mime_type.html" class="function" rel="rdfs-seeAlso">image_type_to_mime_type()</a> - 取得 getimagesize，exif_read_data，exif_thumbnail，exif_imagetype
    所返回的图像类型的 MIME 类型</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>